local xianyuezhan = fk.CreateSkill {
  name = "df__xianyuezhan",
}

Fk:loadTranslationTable{
  ["df__xianyuezhan"] = "弦月斩",
  [":df__xianyuezhan"] = "当你使用伤害牌指定唯一目标时，你可以展示其所有手牌，获得其中与此牌颜色不同的一张。若没有，重置你本回合使用牌次数。",

  ["$df__xianyuezhan1"] = "",
  ["$df__xianyuezhan2"] = "",
}

xianyuezhan:addEffect(fk.AfterCardTargetDeclared, {
  anim_type = "offensive",
  prompt = function (self, player, selected_cards, selected)
     return "展示目标角色所有手牌并触发相应效果"
  end,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(xianyuezhan.name) and data.card.is_damage_card
     and #data.tos == 1
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = data.tos[1]:getCardIds("h")
    if #cards == 0 then return end
    data.tos[1]:showCards(cards)
    local cs=table.filter(cards, function(id)
        return Fk:getCardById(id).color ~= data.card.color
    end)
    if #cs ~= 0 then
      local card = room:askToChooseCard(player, {
      target = data.tos[1],
      flag = { card_data = {{ xianyuezhan.name, cs }} },
      skill_name = xianyuezhan.name,
      prompt = "获得其中一张",
      })
      room:moveCardTo(card, Card.PlayerHand, player, fk.ReasonJustMove, xianyuezhan.name, nil, false, player)
    else
      player:setCardUseHistory("", 0, Player.HistoryGame)
    end
  end,
})

return xianyuezhan
